<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Facades\DB;
/**
 * Class CreateConfigTable
 *  生成迁移: php artisan make:migration create_config_table
 *  运行迁移: php artisan migrate
 */
class CreateConfigTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('config', function (Blueprint $table) {
            $table->increments('id')->comment('编号');
            $table->string('name')->comment('主键名');
            $table->string('value')->nullable(true)->comment('值');
            $table->string('type')->nullable(true)->comment('类型');
            $table->text('desc')->nullable(true)->comment('描述');
        });
        $prefix = DB::getConfig('prefix');
        DB::statement("ALTER TABLE `{$prefix}config` comment '系统基本配置表'"); // 表注释
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('config');
    }
}
